import Vue from 'vue'
import $ from '@/assets/js/jquery-vendor.js'
import axios from 'axios'
import layer from '#/layer/layer.min.js'
import '#/fancybox/jquery.fancybox.css'
import '#/fancybox/jquery.fancybox.js'
import Swal from 'sweetalert2'
import {_$storage, _apiPath, _apiUtil, _axiosContentType, _basePath} from '@/assets/js/constants'

export const $storage = _$storage;
export const apiPath = window.apiPath = _apiPath;
export const basePath = _basePath;
export const axiosContentType = _axiosContentType;
export const apiUtil = _apiUtil;
export const pwdRegex = new RegExp('(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,256}');
window.Swal = Swal;
window._alert = function (msg) {
    Swal.fire(msg);
};
export const site = {
    sign: {// 登录
        verify: apiPath + '/boss/staff/sign/verify',
        encrypt: apiPath + '/boss/staff/sign/encrypt',
        login: apiPath + '/boss/staff/sign/login', // 登录
        logout: apiPath + '/boss/staff/sign/logout', // 登出
        refreshToken: apiPath + '/boss/staff/sign/refreshToken' // 刷新token
    },
    stats: {
        all: apiPath + '/boss/stats/all' // 综合统计
    },
    staff: {// 用户管理
        view: basePath + '/sys/staff',
        page: apiPath + '/boss/staff/page/',
        info: apiPath + '/boss/staff/info/',
        del: apiPath + '/boss/staff/del/',
        save: apiPath + '/boss/staff/save',
        resetpwd: apiPath + '/boss/staff/reset/password/',
        offline: apiPath + '/boss/staff/offline/',
        disabled: apiPath + '/boss/staff/disabled/',
        ownUpdate: apiPath + '/boss/staff/ownupdate',  // 个人信息更新
        ownPassword: apiPath + '/boss/staff/update/ownpassword', // 个人密码更新
        getUserByRole: apiPath + '/boss/staff/get/user/byrole/',
        getRoleByUser: apiPath + '/boss/staff/get/role/byuser/',
        getRoleByOrg: apiPath + '/boss/staff/get/role/byorg/',
        addRole: apiPath + '/boss/staff/add/role',
        delRole: apiPath + '/boss/staff/del/role'
    },
    authPerm: {// 系统功能
        view: basePath + '/sys/auth/perm',
        page: apiPath + '/boss/staff/authPerm/page/',       // 分页
        tree: apiPath + '/boss/staff/authPerm/tree',        // 树
        info: apiPath + '/boss/staff/authPerm/info/'        // 详情
    },
    authRole: {// 角色信息
        view: basePath + '/sys/auth/role',
        list: apiPath + '/boss/staff/authRole/list',
        page: apiPath + '/boss/staff/authRole/page/',       // 分页
        update: apiPath + '/boss/staff/authRole/update',    // 更新
        info: apiPath + '/boss/staff/authRole/info/',       // 详情
        perm: apiPath + '/boss/staff/authRole/perm'
    },
    logLogin: {// 员工登录日志
        view: basePath + '/logs/login',
        page: apiPath + '/boss/logs/logLogin/page/',       // 分页
        save: apiPath + '/boss/logs/logLogin/save',        // 新增or保存
        info: apiPath + '/boss/logs/logLogin/info/',       // 详情
        phydel: apiPath + '/boss/logs/logLogin/phydel/'   // 物理删除
    },
    logOperation: {// 员工操作日志
        view: basePath + '/logs/operation',
        page: apiPath + '/boss/logs/logOperation/page/',       // 分页
        save: apiPath + '/boss/logs/logOperation/save',        // 新增or保存
        info: apiPath + '/boss/logs/logOperation/info/',       // 详情
        phydel: apiPath + '/boss/logs/logOperation/phydel/'   // 物理删除
    },
    sysVariable: {
        view: basePath + '/sys/variable',
        tree: apiPath + '/boss/sys/variable/tree',
        page: apiPath + '/boss/sys/variable/page/',
        info: apiPath + '/boss/sys/variable/info/',
        del: apiPath + '/boss/sys/variable/del/',
        save: apiPath + '/boss/sys/variable/save'
    },
    area: {
        list: apiPath + '/area/list'
    },
    riverStaff: { // 组织体系-河长信息
        view: basePath + '/staff/riverStaff',
        list: apiPath + '/boss/staff/riverStaff/list',
        page: apiPath + '/boss/staff/riverStaff/page/',       // 分页
        save: apiPath + '/boss/staff/riverStaff/save',        // 新增or保存
        info: apiPath + '/boss/staff/riverStaff/info/',       // 详情
        del: apiPath + '/boss/staff/riverStaff/del/'         // 逻辑删除
    },
    riverSupervisor: { // 组织体系-人员信息
        view: basePath + '/staff/riverSupervisor',
        page: apiPath + '/boss/staff/riverSupervisor/page/',       // 分页
        save: apiPath + '/boss/staff/riverSupervisor/save',        // 新增or保存
        info: apiPath + '/boss/staff/riverSupervisor/info/',       // 详情
        del: apiPath + '/boss/staff/riverSupervisor/del/',         // 逻辑删除
        list: apiPath + '/boss/staff/riverSupervisor/list/'         // 所有河长信息
    },
    orgInfo: { // 组织架构
        view: basePath + '/staff/orgInfo',
        tree: apiPath + '/boss/staff/orgInfo/tree',
        page: apiPath + '/boss/staff/orgInfo/page/',       // 分页
        list: apiPath + '/boss/staff/orgInfo/list',
        save: apiPath + '/boss/staff/orgInfo/save',        // 新增or保存
        info: apiPath + '/boss/staff/orgInfo/info/',       // 详情
        del: apiPath + '/boss/staff/orgInfo/del/',         // 逻辑删除
        getStaff: apiPath + '/boss/staff/get/staff/',
        addStaff: apiPath + '/boss/staff/add/staff',
        delStaff: apiPath + '/boss/staff/del/staff',
        getRole: apiPath + '/boss/staff/get/role/',
        addRole: apiPath + '/boss/staff/add/role',
        delRole: apiPath + '/boss/staff/del/role',
        setManager: apiPath + '/boss/staff/set/manager',
        getManager: apiPath + '/boss/staff/get/manager/'
    },
    riverInfo: {// 河湖档案-河道名录
        view: basePath + '/river/riverInfo',
        page: apiPath + '/boss/river/riverInfo/page/',       // 分页
        save: apiPath + '/boss/river/riverInfo/save',        // 新增or保存
        info: apiPath + '/boss/river/riverInfo/info/',       // 详情
        list: apiPath + '/boss/river/riverInfo/list/',       // 所有记录
        del: apiPath + '/boss/river/riverInfo/del/'         // 逻辑删除
    },
    channelInfo: { // 河湖档案-渠道信息
        view: basePath + '/river/channelInfo',
        page: apiPath + '/boss/river/channelInfo/page/',       // 分页
        save: apiPath + '/boss/river/channelInfo/save',        // 新增or保存
        info: apiPath + '/boss/river/channelInfo/info/',       // 详情
        del: apiPath + '/boss/river/channelInfo/del/',         // 逻辑删除
        list: apiPath + '/boss/river/channelInfo/list/'      // 所有记录
    },
    reservoirInfo: { // 河湖档案-水库名录
        view: basePath + '/river/reservoirInfo',
        page: apiPath + '/boss/river/reservoirInfo/page/',       // 分页
        save: apiPath + '/boss/river/reservoirInfo/save',        // 新增or保存
        info: apiPath + '/boss/river/reservoirInfo/info/',       // 详情
        del: apiPath + '/boss/river/reservoirInfo/del/',         // 逻辑删除
        list: apiPath + '/boss/river/reservoirInfo/list/'      // 所有记录
    },
    intakeInfo: { // 河湖档案-取水口信息
        view: basePath + '/river/intakeInfo',
        page: apiPath + '/boss/river/intakeInfo/page/',       // 分页
        save: apiPath + '/boss/river/intakeInfo/save',        // 新增or保存
        info: apiPath + '/boss/river/intakeInfo/info/',       // 详情
        list: apiPath + '/boss/river/intakeInfo/list/',       // 所有记录
        del: apiPath + '/boss/river/intakeInfo/del/'         // 逻辑删除
    },
    drainOutlet: { // 河湖档案-排污口信息
        view: basePath + '/river/drainOutlet',
        page: apiPath + '/boss/river/drainOutlet/page/',       // 分页
        save: apiPath + '/boss/river/drainOutlet/save',        // 新增or保存
        info: apiPath + '/boss/river/drainOutlet/info/',       // 详情
        list: apiPath + '/boss/river/drainOutlet/list/',       // 所有记录
        del: apiPath + '/boss/river/drainOutlet/del/'         // 逻辑删除
    },
    riverBillboard: { // 河湖档案-河长公示牌
        view: basePath + '/river/riverBillboard',
        page: apiPath + '/boss/river/riverBillboard/page/',       // 分页
        save: apiPath + '/boss/river/riverBillboard/save',        // 新增or保存
        info: apiPath + '/boss/river/riverBillboard/info/',       // 详情
        list: apiPath + '/boss/river/riverBillboard/list/',       // 所有记录
        del: apiPath + '/boss/river/riverBillboard/del/'         // 逻辑删除
    },
    riverPolicy: { // 河湖档案-一河一策
        view: basePath + '/river/riverPolicy',
        page: apiPath + '/boss/river/riverPolicy/page/',       // 分页
        save: apiPath + '/boss/river/riverPolicy/save',        // 新增or保存
        info: apiPath + '/boss/river/riverPolicy/info/',       // 详情
        del: apiPath + '/boss/river/riverPolicy/del/'         // 逻辑删除
    },
    sewageTreatment: { // 河湖档案-污水处理
        view: basePath + '/river/sewageTreatment',
        page: apiPath + '/boss/river/sewageTreatment/page/',       // 分页
        save: apiPath + '/boss/river/sewageTreatment/save',        // 新增or保存
        info: apiPath + '/boss/river/sewageTreatment/info/',       // 详情
        list: apiPath + '/boss/river/sewageTreatment/list/',       // 所有记录
        del: apiPath + '/boss/river/sewageTreatment/del/'         // 逻辑删除
    },
    waterFunctionInfo: {
        view: basePath + '/river/water_function_info',
        page: apiPath + '/boss/river/waterFunctionInfo/page/',
        info: apiPath + '/boss/river/waterFunctionInfo/info/',
        list: apiPath + '/boss/river/waterFunctionInfo/list/',
        del: apiPath + '/boss/river/waterFunctionInfo/del/',
        save: apiPath + '/boss/river/waterFunctionInfo/save'
    },
    drinkingwaterSource: {
        view: basePath + '/river/drinkingwater_source',
        page: apiPath + '/boss/river/drinkingwaterSource/page/',
        info: apiPath + '/boss/river/drinkingwaterSource/info/',
        del: apiPath + '/boss/river/drinkingwaterSource/del/',
        save: apiPath + '/boss/river/drinkingwaterSource/save'
    },
    waterProtectionArea: {
        view: basePath + '/river/water_protection_area',
        page: apiPath + '/boss/river/waterProtectionArea/page/',
        info: apiPath + '/boss/river/waterProtectionArea/info/',
        del: apiPath + '/boss/river/waterProtectionArea/del/',
        save: apiPath + '/boss/river/waterProtectionArea/save'
    },
    waterShoreline: {
        view: basePath + '/river/water_shoreline',
        page: apiPath + '/boss/river/waterShoreline/page/',
        info: apiPath + '/boss/river/waterShoreline/info/',
        list: apiPath + '/boss/river/waterShoreline/list/',
        del: apiPath + '/boss/river/waterShoreline/del/',
        save: apiPath + '/boss/river/waterShoreline/save'
    },
    cases: {
        view: basePath + '/river/cases',
        page: apiPath + '/boss/river/cases/page/',
        info: apiPath + '/boss/river/cases/info/',
        del: apiPath + '/boss/river/cases/del/',
        save: apiPath + '/boss/river/cases/save'
    },
    pumpGate: {
        view: basePath + '/river/pump_gate',
        page: apiPath + '/boss/river/pumpGate/page/',
        info: apiPath + '/boss/river/pumpGate/info/',
        list: apiPath + '/boss/river/pumpGate/list/',
        del: apiPath + '/boss/river/pumpGate/del/',
        save: apiPath + '/boss/river/pumpGate/save'
    },
    station: {
        view: basePath + '/river/station',
        page: apiPath + '/boss/river/station/page/',
        info: apiPath + '/boss/river/station/info/',
        list: apiPath + '/boss/river/station/list/',
        del: apiPath + '/boss/river/station/del/',
        save: apiPath + '/boss/river/station/save'
    },
    inspectionPlan: {
        view: basePath + '/patrol/inspection_plan',
        page: apiPath + '/boss/patrol/inspectionPlan/page/',
        info: apiPath + '/boss/patrol/inspectionPlan/info/',
        del: apiPath + '/boss/patrol/inspectionPlan/del/',
        save: apiPath + '/boss/patrol/inspectionPlan/save'
    },
    patrolTask: {
        view: basePath + '/patrol/patrol_task',
        page: apiPath + '/boss/patrol/patrolTask/page/',
        info: apiPath + '/boss/patrol/patrolTask/info/',
        del: apiPath + '/boss/patrol/patrolTask/del/',
        save: apiPath + '/boss/patrol/patrolTask/save',
        patrolStat: apiPath + '/boss/patrol/patrolTask/patrolStat',
        exportXls: apiPath + '/boss/patrol/patrolTask/patrolStatExport/xls',
        exportPatrolTaskLog: apiPath + '/boss/patrol/patrolTask/patrolTaskLog/export',
        exportPatrolTaskLogJunior: apiPath + '/boss/patrol/patrolTask/patrolTaskLogJunior/export'
    },
    completionStat: {
        view: basePath + '/patrol/completion_stat',
        page: apiPath + '/boss/patrol/patrolTask/completionStat/page/'
    },
    patrolTaskLog: {
        view: basePath + '/patrol/patrol_log_peer',
        logDetail: basePath + '/patrol/log_detail/',
        download: apiPath + '/boss/patrol/patrolTask/patrolTaskLog/download',
        detail: apiPath + '/boss/patrol/patrolTask/patrolTaskLog/detail',
        del: apiPath + '/boss/patrol/patrolTask/logDel/',
        page: apiPath + '/boss/patrol/patrolTask/patrolTaskLog/page/'
    },
    patrolTaskLogJunior: {
        view: basePath + '/patrol/patrol_log_junior',
        page: apiPath + '/boss/patrol/patrolTask/patrolTaskLogJunior/page/'
    },
    reportBimonthly: { // 双月报
        view: basePath + '/report/reportBimonthly',
        page: apiPath + '/boss/report/reportBimonthly/page/',       // 分页
        save: apiPath + '/boss/report/reportBimonthly/save',        // 新增or保存
        info: apiPath + '/boss/report/reportBimonthly/info/',       // 详情
        del: apiPath + '/boss/report/reportBimonthly/del/'         // 逻辑删除
    },
    reportMonthly: { // 月小结报
        view: basePath + '/report/reportMonthly',
        page: apiPath + '/boss/report/reportMonthly/page/',       // 分页
        save: apiPath + '/boss/report/reportMonthly/save',        // 新增or保存
        info: apiPath + '/boss/report/reportMonthly/info/',       // 详情
        del: apiPath + '/boss/report/reportMonthly/del/'         // 逻辑删除
    },
    reportTenday: { // 旬报
        view: basePath + '/report/reportTenday',
        page: apiPath + '/boss/report/reportTenday/page/',       // 分页
        save: apiPath + '/boss/report/reportTenday/save',        // 新增or保存
        info: apiPath + '/boss/report/reportTenday/info/',       // 详情
        del: apiPath + '/boss/report/reportTenday/del/'         // 逻辑删除
    },
    reportYear: { // 年报
        view: basePath + '/report/reportYear',
        page: apiPath + '/boss/report/reportYear/page/',       // 分页
        save: apiPath + '/boss/report/reportYear/save',        // 新增or保存
        info: apiPath + '/boss/report/reportYear/info/',       // 详情
        del: apiPath + '/boss/report/reportYear/del/'         // 逻辑删除
    },
    reportWorkBrief: { // 工作简报
        view: basePath + '/report/reportWorkBrief',
        page: apiPath + '/boss/report/reportWorkBrief/page/',       // 分页
        save: apiPath + '/boss/report/reportWorkBrief/save',        // 新增or保存
        info: apiPath + '/boss/report/reportWorkBrief/info/',       // 详情
        del: apiPath + '/boss/report/reportWorkBrief/del/'         // 逻辑删除
    },
    reportTask: { // 报送任务-任务发起
        view: basePath + '/report/reportTask',
        page: apiPath + '/boss/report/reportTask/page/',       // 分页
        save: apiPath + '/boss/report/reportTask/save',        // 新增or保存
        info: apiPath + '/boss/report/reportTask/info/',       // 详情
        itemPage: apiPath + '/boss/report/reportTask/item/page/',
        itemAudit: apiPath + '/boss/report/reportTask/item/audit'
    },
    reportTaskSubmit: { // 报送任务-信息填报
        view: basePath + '/report/reportTaskSubmit',
        page: apiPath + '/boss/report/reportTaskSubmit/page/',       // 分页
        save: apiPath + '/boss/report/reportTaskSubmit/save',        // 新增or保存
        info: apiPath + '/boss/report/reportTaskSubmit/info/'       // 详情
    },
    map: { // 地图
        mapll: basePath + '/map/mapll',
        none: basePath + '/map/none'
    },
    reportEvent: { // 任务处理-上报事件
        view: basePath + '/report/reportEvent',
        page: apiPath + '/boss/report/reportEvent/page/',       // 分页
        info: apiPath + '/boss/report/reportEvent/info/',       // 详情
        follow: apiPath + '/boss/report/reportEvent/follow/', // 关注
        complaintDel: apiPath + '/boss/report/reportEvent/complaint/del/', // 删除
        supervision: apiPath + '/boss/report/reportEvent/supervision', // 督办
        treatment: apiPath + '/boss/report/reportEvent/treatment' // 分配处理
    },
    longRiverLog: {
        view: basePath + '/river/longRiverLog'
    },
    sysNews: { // 新闻资讯
        view: basePath + '/sys/sysNews',
        page: apiPath + '/boss/sys/sysNews/page/',       // 分页
        save: apiPath + '/boss/sys/sysNews/save',        // 新增or保存
        info: apiPath + '/boss/sys/sysNews/info/',       // 详情
        del: apiPath + '/boss/sys/sysNews/del/'         // 逻辑删除
    },
    examineMainTarget: { //  目标考核-主要目标
        view: basePath + '/examine/examineMainTarget',
        page: apiPath + '/boss/examine/examineMainTarget/page/',       // 分页
        save: apiPath + '/boss/examine/examineMainTarget/save',        // 新增or保存
        info: apiPath + '/boss/examine/examineMainTarget/info/',       // 详情
        del: apiPath + '/boss/examine/examineMainTarget/del/'         // 逻辑删除
    },
    examineTarget: { // 目标考核-考核指标
        view: basePath + '/examine/examineTarget',
        importView: basePath + '/examine/examineTargetImport',
        page: apiPath + '/boss/examine/examineTarget/page/',       // 分页
        save: apiPath + '/boss/examine/examineTarget/save',        // 新增or保存
        info: apiPath + '/boss/examine/examineTarget/info/',       // 详情
        list: apiPath + '/boss/examine/examineTarget/list/',       // 列表
        del: apiPath + '/boss/examine/examineTarget/del/'         // 逻辑删除
    },
    examineTargetDetail: { // 目标考核-考核指标详细
        view: basePath + '/examine/examineTargetDetail',
        page: apiPath + '/boss/examine/examineTargetDetail/page/',       // 分页
        save: apiPath + '/boss/examine/examineTargetDetail/save',        // 新增or保存
        info: apiPath + '/boss/examine/examineTargetDetail/info/',       // 详情
        del: apiPath + '/boss/examine/examineTargetDetail/del/',         // 逻辑删除
        importTarget: apiPath + '/boss/examine/examineTargetDetail/importTarget' // 导入历史考核指标
    },
    examineEvaluate: { // 目标考核-考核评估
        view: basePath + '/examine/examineEvaluate',
        page: apiPath + '/boss/examine/examineEvaluate/page/',       // 分页
        save: apiPath + '/boss/examine/examineEvaluate/save',        // 新增or保存
        info: apiPath + '/boss/examine/examineEvaluate/info/',       // 详情
        del: apiPath + '/boss/examine/examineEvaluate/del/'         // 逻辑删除
    },
    examineSelfEvaluation: { // 目标考核-考核自评
        view: basePath + '/examine/examineSelfEvaluation'
    },
    examineLeaderEvaluation: { // 目标考核-上级评分
        view: basePath + '/examine/examineLeaderEvaluation'
    },
    examineResult: { // 目标考核-考核结果
        view: basePath + '/examine/examineResult',
        page: apiPath + '/boss/examine/examineResult/page/',       // 分页
        save: apiPath + '/boss/examine/examineResult/save',        // 新增or保存
        info: apiPath + '/boss/examine/examineResult/info/',       // 详情
        del: apiPath + '/boss/examine/examineResult/del/',         // 逻辑删除
        findJuniorDataIsPage: apiPath + '/boss/examine/examineResult/findJuniorDataIsPage/', // 分页查询下级
        getResults: apiPath + '/boss/examine/examineResult/getResults', // 获取考核结果明细
        updateLeaderScore: apiPath + '/boss/examine/examineResult/updateLeaderScore' // 保存上级评分
    },
    analysis: {
        riverSupervisor: {
            view: basePath + '/analysis/river/supervisor',
            areaPage: apiPath + '/boss/analysis/river/supervisor/area/page/',       // 本次级河长数量-分页
            areaLevel: apiPath + '/boss/analysis/river/supervisor/area/level',       // 各级河长数量-all
            areaName: apiPath + '/boss/analysis/river/supervisor/area/name',       // 次级行政区划河长数量
            exportXls: apiPath + '/boss/analysis/river/supervisor/export/xls'
        },
        riverReach: { // 河道统计
            view: basePath + '/analysis/river/reach',
            page: apiPath + '/boss/analysis/riverInfoStat/page/', // 列表分页查询
            statLevelNum: apiPath + '/boss/analysis/riverInfoStat/statLevelNum', // 统计各级河道
            exportXls: apiPath + '/boss/analysis/riverInfoStat/exportExcel'
        },
        water: {
            view: basePath + '/analysis/water'
        },
        patrol: {
            view: basePath + '/analysis/patrol'
        },
        complaintTreatment: {
            view: basePath + '/analysis/complaint/treatment',
            areaPage: apiPath + '/boss/analysis/complaint/area/page/',
            areaRate: apiPath + '/boss/analysis/complaint/area/rate',
            exportXls: apiPath + '/boss/analysis/complaint/export/xls'
        },
        complaintType: {
            view: basePath + '/analysis/complaint/type',
            areaType: apiPath + '/boss/analysis/complaint/area/type'
        },
        eventTreatment: {
            view: basePath + '/analysis/event/treatment',
            areaPage: apiPath + '/boss/analysis/event/area/page/',
            areaRate: apiPath + '/boss/analysis/event/area/rate',
            exportXls: apiPath + '/boss/analysis/event/export/xls'
        },
        eventType: {
            view: basePath + '/analysis/event/type',
            areaType: apiPath + '/boss/analysis/event/area/type'
        },
        examineLevel: {
            view: basePath + '/analysis/examine/level',
            levelStat: apiPath + '/boss/analysis/examineResultStat/statResultLevelByParentAreaId'
        },
        examineRanking: {
            view: basePath + '/analysis/examine/ranking',
            rankStat: apiPath + '/boss/analysis/examineResultStat/statResultRankByParentAreaId'
        }
    },
    feedback: { // 意见反馈
        view: basePath + '/sys/feedback',
        page: apiPath + '/boss/sys/feedback/page/',       // 分页
        info: apiPath + '/boss/sys/feedback/info/'       // 详情
    },
    sysNewsPublicity: { // 宣传引导
        view: basePath + '/sys/sysNews',
        page: apiPath + '/boss/sys/sysNewsPublicity/page/',       // 分页
        save: apiPath + '/boss/sys/sysNewsPublicity/save',        // 新增or保存
        info: apiPath + '/boss/sys/sysNewsPublicity/info/',       // 详情
        del: apiPath + '/boss/sys/sysNewsPublicity/del/'         // 逻辑删除
    }
};

export const ueConfig = window.ueConfig = {
    // 编辑器不自动被内容撑高
    autoHeightEnabled: false,
    // 初始容器高度
    initialFrameHeight: 240,
    // 初始容器宽度
    initialFrameWidth: '100%',
    // 上传文件接口（这个地址是我为了方便各位体验文件上传功能搭建的临时接口，请勿在生产环境使用！！！）
    serverUrl: window.apiPath + '/file/ue/controller',
    // UEditor 资源文件的存放路径，如果你使用的是 vue-cli 生成的项目，通常不需要设置该选项，vue-ueditor-wrap 会自动处理常见的情况，如果需要特殊配置，参考下方的常见问题2
    scaleEnabled: false
};

axios.defaults.headers = {
    'Authorization': $storage.getItem('authorizationToken') || ''
};
axios.interceptors.request.use(function (config) {
    try {
        config.headers['Authorization'] = $storage.getItem('authorizationToken') || '';
        if (!apiUtil.startWith(config.url, apiPath + '/boss/staff/sign/') && !apiUtil.startWith(config.url, apiPath + '/file/')) {
            window.staff.init();
        }
        layer.load();
        setTimeout(function () {
            layer.closeAll('loading');
        }, 5000);
    } catch (fail) {
        console.error(fail)
    }
    return config;
});

axios.interceptors.response.use(function (response) {
    try {
        let result = response.data;
        // console.info(result)
        if (result.code === 403 || result.code === 110) { // 授权验证失败!
            if (result.code === 110) {
                // console.error(result);
                // Swal.fire(result.message);
            }
            Swal.fire(result.message)
            window.staff.flushAuth();
        }
        setTimeout(function () {
            try {
                layer.closeAll('loading');
            } catch (fail) {
            }
        }, 300);
    } catch (fail) {
        Swal.fire(JSON.stringify(fail));
        window.staff.flushAuth();
    }
    return response;
});

/** 员工信息 */
export class Staff {
    encrypt(callback) {
        axios.post(site.sign.encrypt, {}).then((response) => {
            let result = response.data;
            if (result.code === 0) {
                let data = result.data;
                callback && callback(data);
            }
        }).catch((fail) => {
            console.error(JSON.stringify(fail))
        });
    }

    login(formData, callback) {
        axios.post(site.sign.login, formData).then((response) => {
            let result = response.data;
            window.$vueApp.result = result;
            if (result.code === 0) {
                if (result.data) {
                    $storage.setItem('staff', JSON.stringify(result.data.staff));
                    if (result.data.authorizationToken) {
                        $storage.setItem('tokenExpMillis', result.data.tokenExpMillis);
                        $storage.setItem('authorizationToken', result.data.authorizationToken);
                        $storage.setItem('authorizationInfoPerms', result.data.staff.authorizationInfoPerms);
                        $storage.setItem('authorizationInfoRoles', result.data.staff.authorizationInfoRoles);
                        axios.defaults.headers = {
                            'Authorization': $storage.getItem('authorizationToken') || ''
                        };
                    }
                }
                callback && callback(result);
            }
        }).catch((fail) => {
            console.error(JSON.stringify(fail))
        });
    }

    refreshToken(callback) {
        axios.get(site.sign.refreshToken, {}).then(function (response) {
            let result = response.data;
            if (result.code === 0) {
                if (result.data) {
                    if (result.data.authorizationToken) {
                        $storage.setItem('tokenExpMillis', result.data.tokenExpMillis);
                        $storage.setItem('authorizationToken', result.data.authorizationToken);
                        axios.defaults.headers = {
                            'Authorization': $storage.getItem('authorizationToken') || ''
                        };
                    }
                }
                callback && callback();
            } else {
                console.error(result);
                Swal.fire(result.message);
            }
        }).catch(function (fail) {
            console.error(JSON.stringify(fail))
        });
    }

    logout(callback) {
        let that = this
        axios.get(site.sign.logout, {}).then(function (response) {
            that.flushAuth(callback);
        }).catch((error) => {
            console.log(error);
            that.flushAuth(callback);
        });
    }

    info(callback) {
        let staffJson = $storage.getItem('staff');
        if (staffJson) {
            let staffInfo = JSON.parse(staffJson) || {};
            Vue.prototype.staffInfo = staffInfo;
            // console.info(JSON.stringify(window.$vueApp.staffInfo))
        }
        callback && callback();
    }

    init(callback) {
        try {
            let that = this
            let expMillis = 0;
            if ($storage.getItem('tokenExpMillis')) {
                expMillis = $storage.getItem('tokenExpMillis') - (new Date().getTime());
            }
            if (expMillis > 0 && expMillis < (10 * 60 * 1000)) { // 还有10分钟过期
                that.refreshToken(callback);
            } else {
                if ($storage.getItem('staff') && expMillis > 0) {
                    that.info(callback);
                } else {
                    that.flushAuth(callback);
                }
            }
        } catch (e) {
        }
    }

    flushAuth(callback) {
        $storage.clear();
        // callback && callback();
        // top.location.href = '/login';
        window.$vueApp.$router.push({
            name: 'Login'
        })
    }

    // -- 权限
    hasPermission(str) {
        let authorizationInfo = $storage.getItem('authorizationInfoPerms');
        if (authorizationInfo) {
            let permsArr = authorizationInfo.split(',');
            return !!(permsArr && permsArr.indexOf(str) !== -1);
        }
        return false;
    }

    // -- 角色
    hasRole(str) {
        let authorizationInfo = $storage.getItem('authorizationInfoRoles');
        if (authorizationInfo) {
            let permsArr = authorizationInfo.split(',');
            return !!(permsArr && permsArr.indexOf(str) !== -1);
        }
        return false;
    }

    staffDto

    dto() {
        if (!this.staffDto) {
            this.staffDto = JSON.parse($storage.getItem('staff')) || {};
        }
        return this.staffDto;
    }
}

export const apiBox = {
    openMyTopBoxLayer(mytitle, myurl) {
        let layerStyle = {
            type: 2,
            title: [mytitle, 'background:rgba(80, 80, 80, 0.9); height:40px; color:#eee; border:none;'], // 自定义标题样式
            border: [0],
            area: ['100%', '100%'], // 自定义弹框大小
            content: myurl
        };
        window.top.layer.open(layerStyle);
        // $('body').css("overflow", "hidden");
        $('#bg').bind('touchmove mousewheel', function (e) {
            e.preventDefault();
        });
        $('.layui-layer-setwin').click(function () {
            $('body', top.document).css('overflow', '');
            $('body').css('overflow', '');
            try {
                // 获取当前窗口索引
                let index = top.layer.getFrameIndex(window.name);
                // 关闭iframe
                top.layer.close(index);
            } catch (e) {
            }
        });
    },
    openMyBoxLayer(mytitle, myurl) {
        this.openMyBoxLayerC(mytitle, myurl, 'background:#fff; height:40px; color:#333; border:none;', ['89%', '95%']);
    },
    openMyBoxLayerB(mytitle, myurl, areaStyle) {
        this.openMyBoxLayerC(mytitle, myurl, 'background:#fff; height:40px; color:#333; border:none;', areaStyle);
    },
    openMyBoxLayerC(mytitle, myurl, titleStyle, areaStyle) {
        if (mytitle === 'a') {
            mytitle = '信息新增';
        }
        if (mytitle === 'e') {
            mytitle = '信息修改';
        }
        if (mytitle === 'i') {
            mytitle = '信息查看';
        }
        let layerStyle = {
            type: 2,
            title: [mytitle, titleStyle], // 自定义标题样式
            border: [0],
            area: ['89%', '95%'], // 自定义弹框大小
            content: myurl
        };
        if (areaStyle) layerStyle.area = areaStyle;
        // console.info(layerStyle)
        layer.open(layerStyle);
        $('body').css('overflow', 'hidden');
        $('#bg').bind('touchmove mousewheel', function (e) {
            e.preventDefault();
        });
        let that = this
        $('.layui-layer-setwin').click(function () {
            that.closeMyBoxLayer();
        });
    },
    closeMyBoxLayer() {
        $('body', parent.document).css('overflow', '');
        $('body').css('overflow', '');
        try {
            // 获取当前窗口索引
            let index = parent.layer.getFrameIndex(window.name);
            // 关闭iframe
            parent.layer.close(index);
        } catch (e) {
        }
    }
};
// areaIds: JSON.parse($storage.getItem('staff')).areaId ? JSON.parse($storage.getItem('staff')).areaId : '',
// areaNames: JSON.parse($storage.getItem('staff')).areaName ? JSON.parse($storage.getItem('staff')).areaName : ''
Vue.prototype.staffInfo = {};
Vue.prototype.site = site;
Vue.prototype.staff = window.staff = new Staff();
Vue.prototype.lbox = apiBox;
Vue.prototype.selected = function (val1, val2) {
    return val1 === val2;
};
Vue.prototype.openFancyBox = function (_url, _title) {
    $.fancybox({href: _url, title: _title});
};

export function delImgGrid($ele, flag) {
    if (flag) {
        $($ele).parent().remove();
    } else {
        $($($ele).parent()).html('<img src="' + require('@/assets/images/noneImage.png') + '" style="width:220px;height:100px">');
    }
}

Vue.prototype.delAudioGrid = window.delAudioGrid = function ($ele, flag) {
    if (flag) {
        $($ele).parent().remove();
    } else {
        $($($ele).parent()).html('<img src="' + require('@/assets/images/noneAudio.png') + '" style="width:220px;height:100px">');
    }
};
Vue.prototype.delImgGrid = window.delImgGrid = function (ele, flag) {
    if (ele.currentTarget) {
        delImgGrid(ele.currentTarget, flag);
    } else {
        delImgGrid(ele, flag);
    }
};
//  注册
Vue.filter('date', function (value, fmt) {
    if (!value) return '';
    if (('' + value).indexOf('-') !== -1) {
        return value;
    }
    let date = new Date(value);
    return apiUtil.formatDate(date, fmt || 'yyyy-MM-dd HH:mm:ss');
});
Vue.filter('money', function (value) {
    value = Number(value).toFixed(2);
    if (value === 0) {
        return '￥<span>0</span>';
        // eslint-disable-next-line eqeqeq
    } else if (value.split('.')[1].substring(1) == 0) {
        value = Number(value).toFixed(2);
    }
    let _val = value.split('.');
    return '￥<span style="color: #0b8090;">' + _val[0] + '</span><em style="color: red;">.' + _val[1] + '</em>';
});
Vue.filter('message', function (result, text) {
    if (result.code === 0) {
        return text || '暂无数据';
    }
    return result.message;
});

if ($.validator) {
    $.validator.setDefaults({
        highlight(element) {
            $(element).closest('.form-group').removeClass('has-success').addClass('has-error');
        },
        success(element) {
            element.closest('.form-group').removeClass('has-error').addClass('has-success');
        },
        errorElement: 'span',
        errorPlacement(error, element) {
            if (element.is(':radio') || element.is(':checkbox')) {
                error.appendTo(element.parent().parent().parent());
            } else {
                error.appendTo(element.parent());
            }
        },
        errorClass: 'help-block m-b-none',
        validClass: 'help-block m-b-none'
    });
}

if ($ && $.fn) {
    $.fn.serializeObject = function () {
        let o = {};
        let a = this.serializeArray();
        $.each(a, function () {
            if (o[this.name] !== undefined) {
                if (!o[this.name].push) {
                    o[this.name] = [o[this.name]];
                }
                o[this.name].push(this.value || '');
            } else {
                o[this.name] = this.value || '';
            }
        });
        return o;
    };
}

export const ishtmltop = window.ishtmltop;

// 判断当前页面是否在iframe中
if (top === this && !ishtmltop) {
    $('body').append('<div class="gohome"><a class="animated bounceInUp" href="' + basePath + '/index" title="返回首页"><i class="fa fa-home"></i></a></div>');
}

export const zTreeBridge = {
    radio: {
        radioType: 'all',
        enable: true,
        chkStyle: 'radio',
        chkboxType: {'Y': '', 'N': ''}
    },
    checkbox: {
        autoCheckTrigger: true,
        enable: true,
        chkStyle: 'checkbox'
    },
    zTreeObjChkDisabled(zTreeObj, node) {
        if (!node) return;
        zTreeObj.setChkDisabled(node, true);
        if (node.children && node.children.length > 0) {
            for (let chnode in node.children) {
                zTreeBridge.zTreeObjChkDisabled(zTreeObj, node.children[chnode]);
            }
        }
    },
    getAndSetTreeRoot(nodes) {
        return {id: 'root', isParent: true, name: '根节点', open: true, children: nodes};
    },
    zTreeHistNode(zTreeObj, histVal, treeNode) {
        if (!histVal) {
            return false;
        }
        if (treeNode && (treeNode && treeNode.id) && histVal === (treeNode && treeNode.id)) {
            zTreeObj.checkNode(treeNode, true, false);
            return true;
        }
        if (treeNode instanceof Array || Object.prototype.toString.call(treeNode) === '[object Array]') {
            for (let i = 0; i < treeNode.length; i++) {
                zTreeBridge.zTreeHistNode(zTreeObj, histVal, treeNode[i]);
            }
        } else if (treeNode.children) {
            for (let i = 0; i < treeNode.children.length; i++) {
                zTreeBridge.zTreeHistNode(zTreeObj, histVal, treeNode.children[i]);
            }
        }
    }
};

export const getFileServerJoinContextPath = function (_path) {
    if (!(new RegExp('^http').test(_path))) {
        return apiPath + _path
    } else {
        return _path
    }
}
